package com.sunny.common.redisson.properties;

import com.sunny.common.redisson.enums.RedisModel;
import lombok.Data;
import org.redisson.config.SslProvider;
import org.redisson.config.TransportMode;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

import java.net.URL;

@Data
@ConfigurationProperties(prefix = "redisson")
public class RedissonProperties {

    private RedisModel model = RedisModel.SINGLE;
    private String codec = "org.redisson.codec.JsonJacksonCodec";
    private Integer threads;
    private Integer nettyThreads;
    private TransportMode transportMode = TransportMode.NIO;

    /** 公共参数 **/
    private Integer idleConnectionTimeout = 10000;
    private Integer connectTimeout = 10000;
    private Integer timeout = 3000;
    private Integer retryAttempts = 3;
    private Integer retryInterval = 1500;
    private String password;
    private Integer subscriptionsPerConnection = 5;
    private String clientName;
    private Boolean sslEnableEndpointIdentification = true;
    private SslProvider sslProvider = SslProvider.JDK;
    private URL sslTruststore;
    private String sslTruststorePassword;
    private URL sslKeystore;
    private String sslKeystorePassword;
    private Integer pingConnectionInterval = 10000;
    private Boolean keepAlive = false;
    private Boolean tcpNoDelay = false;
    private Boolean referenceEnabled = true;
    private Long lockWatchdogTimeout = 30000L;
    private Boolean keepPubSubOrder = true;
    private Boolean useScriptCache = false;
    private Integer minCleanUpDelay = 5;
    private Integer maxCleanUpDelay = 1800;

    // 结束

    @NestedConfigurationProperty
    private SingleServerConfig singleServerConfig;
    @NestedConfigurationProperty
    private MultipleServerConfig multipleServerConfig;

}
